{extend name="base"/}
{block name="resources"}
{/block}
{block name="main"}


<table id="community_account" lay-filter="community_account"></table>

<!-- 工具栏操作 -->
<script type="text/html" id="operation">
    <div class="ns-table-btn">
        <a class="layui-btn" lay-event="detail">详情</a>
    </div>
</script>
{/block}
{block name="script"}
<script>
    layui.use(['form'], function() {
        var table,
            form = layui.form;

        /**
         * 加载表格
         */
        table = new Table({
            elem: '#community_account',
            url : ns.url("shop/community/accountList"),
            where:{
                cl_id : $("input[name='cl_id']").val(),
            },
            cols: [
                [{
                    field: 'account_no',
                    title: '账单编号',
                    width: '15%',
                    unresize: 'false'
                }, {
                    field: 'money',
                    title: '数据金额',
                    width: '15%',
                    unresize: 'false',
                }, {
                    field: 'type_name',
                    title: '发生方式',
                    width: '15%',
                    unresize: 'false'
                }, {
                    field: 'create_time',
                    title: '发生时间',
                    width: '20%',
                    unresize: 'false',
                    templet: function(data) {
                        return ns.time_to_date(data.create_time);
                    }
                }]
            ]
        });

        /**
         * 监听工具栏操作
         */
        table.tool(function(obj) {
            var data = obj.data;
            switch (obj.event) {
                case 'detail': //详情
                    var url = "shop/order/detail";
                    window.open(ns.url(url,{order_id:data.order_id}));
                    break;
            }
        });

        /**
         * 搜索功能
         */
        form.on('submit(search)', function(data) {
            table.reload({
                page: {
                    curr: 1
                },
                where: data.field
            });
            return false;
        });
    })
</script>
{/block}